<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="/vue/lib/vue.js"></script>

</head>

<body>
  <div id="box">
    <!-- v-if控制页面的显示与隐藏 与v-show一样-->
    <h1 v-show="true">我是v-show里面的true</h1>
    <h1 v-if="show">我是if的隐藏款</h1>
    <h1 v-show="!show">我是show的显示款</h1>
    <h2>{{age}}</h2>
    <button @click="chufa">展示出来隐藏的标签</button>
  </div>
  <script>
    var vue = new Vue({
      el: '#box',
      data: {
        mag: '大美女',
        age: 18,
        show: false
      },
      methods: {
        chufa() {
          // if (this.show == true) {
          //   this.show = false
          // }
          // else {
          //   this.show = true
          // }
          this.show = !this.show//简写
        }

      }
    })
  </script>
</body>

</html>